import java.util.Scanner;

public class Main {
    public static int fib(int n) {//斐波那契数列函数
        if(n==1 || n==2) return n;
        return fib(n-1)+fib(n-2);
    }
    public static int fun(int n){//每一位的累加和递归
        if(n<10) {
            return n;
        }
        else{
            int ret=fun(n/10)+n%10;
            return ret;
        }
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int s=fun(n);
        System.out.println(s);
    }
    public static void main3(String[] args) {
        int i=1;
        while(i<=100) {
            int ret=i;
            if(ret%3!=0&&ret%4!=0) {
                i++;
                continue;
            }
                System.out.println(ret);
            i++;
        }
    }
    public static void main2(String[] args) {
        int i=1;
        int sum=0;
        while(i<=5) {
            int j=1;
            int ret=1;
            while(j<=i) {
                ret*=j;
                j++;
            }
            sum+=ret;
            i++;
        }
        System.out.println(sum);
    }
    public static void main1(String[] args) {
        int year=2000;
        if((year%400==0)||(year%4==0)&&(year%100!=0))
        {
            System.out.println("是闰年");
        }
    }
}